package com.jiangcheng.demo.entity;

import lombok.Data;

import java.time.LocalDateTime;
import java.util.Date;

@Data
public class UserTest implements Comparable<Object>{
    private String name;
    private Integer age;
    private Date date;

    public UserTest(String name, Integer age, Date date){
        this.name = name;
        this.age = age;
        this.date = date;
    }
    public UserTest(String name,Integer age){
        this.name = name;
        this.age = age;
    }

    @Override
    public int compareTo(Object o) {
        UserTest userTest = (UserTest) o;
        int u1 = (int)userTest.date.getTime();
        int u2 = (int)userTest.getDate().getTime();
        return  u2 - u1;
    }

}
